/**
 * FormattedRuntimeException
 *
 * @author Chris Pratt
 *
 * 12/12/2011
 */
package com.anodyzed.onyx.util;

import com.anodyzed.onyx.text.TextFormat;

@SuppressWarnings("serial")
public class FormattedRuntimeException extends RuntimeException {

  /**
   * No-arg Constructor
   */
  public FormattedRuntimeException () {
    super();
  } //FormattedRuntimeException

  /**
   * Constructor
   *
   * @param msg A Descriptive Message Format String about the cause of the Exception 
   * @param args Replacement Arguments for the Format String
   */
  public FormattedRuntimeException (String msg,Object... args) {
    super(TextFormat.format(msg,args));
    Throwable t = ((args != null) && (args.length > 0) && (args[args.length - 1] instanceof Throwable)) ? (Throwable)args[args.length - 1] : null;
    if(t != null) {
      initCause(t);
    }
  } //FormattedRuntimeException

  /**
   * Constructor
   *
   * @param cause The Throwable that initiated this Exception Chain
   */
  public FormattedRuntimeException (Throwable cause) {
    super(cause);
  } //FormattedRuntimeException

} //*FormattedRuntimeException
